package com.qmyx.supplychain.quartz.task;

import com.ytjj.qmyx.supplychain.service.StockWarningService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 库存预警定时任务
 */
@Component
@Slf4j
public class StockWarningTask {

    @Autowired
    private StockWarningService stockWarningService;

    /**
     * 定时任务:检查商品规格库存,低于商品库存预警值发短信通知供应商
     */
    @Scheduled(cron = "0 0/5 * * * ?")
    public void verifySpecStock() {
        log.info("===== 开始检查商品规格库存,低于商品库存预警值发短信通知供应商 =====");
        stockWarningService.verifySpecStock();
        log.info("===== 结束检查商品规格库存,低于商品库存预警值发短信通知供应商 =====");
    }
}
